<template>
	<view>
		<!-- 大标题 -->
		<view class="title">
			<text class="txt">{{text}}</text>
			<view class="small">
				<text @click="gotoelse(text)">更多</text>
				<u-icon name="arrow-right-double"></u-icon>
			</view>
		</view>
		<!-- 下划线 -->
		<u-line color="#D0587C"></u-line>
		<!-- 项 -->
		<u-scroll-list indicatorActiveColor="#D0587C" 
		indicatorStyle ="display:none;">
			<!-- 此处循环 -->
			<view v-for="(item, index) in list" :key="index">
				<!-- 此处是图片 -->
				<view class="imgstyle" @click="imgClickFn(item)">
					<u--image bgColor="#D0587C" radius="30rpx" :showLoading="true" :src="item" width="90px" height="90px" :lazy-load="true"></u--image>
				</view>
			</view>
		</u-scroll-list>
		<!-- 这里存放可以被展示的信息 -->
		<view @longpress="longpress" class="moreimages">
			<u-overlay :show="imgshow" @click="imgshow=false">
				<image mode="widthFix" width="720rpx" height="auto" :showLoading="true" :src="checkimg" :lazy-load="true" class="imgstyles"></image>
			</u-overlay>
		</view>
		<u-modal :show="show" title="温馨提示" content='您还未登录!请先登录后再尝试!' @confirm="tologin"></u-modal>
	</view>
</template>

<script>
	export default {
		name:"type",
		data() {
			return {
				show : false,
				checkimg:'',
				imgshow:false,
				indicator: false
			};
		},
		props:['text','list'],
		methods:{
			imgClickFn(item){
				this.checkimg = item
				this.open()
				
			},
			open(){
				this.imgshow = true
			},
			longpress(){
				// console.log('长按下载图片');
				/*
				uni.downloadFile({
					url: '图片下载的地址  this.checkimg' 
					success:()=>{
						成功
					},
					fail:()=>{
						失败
					},
					filePath:"下载文件的本地路径"  必填
					
					
					未完整,只是将图片保存到临时文件
				})
				
				
				*/
			},
			gotoelse(text){
				if(!uni.getStorageSync('token')){
					this.show = true
					return
				}
				uni.navigateTo({
					url:`/pages/topck/topck?type=${text}`
				})
				
			},
			tologin(){
				this.show = false
				uni.switchTab({
					url:'/pages/user/user'
				})
			}
			
		}
	}
</script>

<style lang="scss">
.imgstyle{
	padding: 40rpx 14rpx;
	background-color: rgba(208,88,124,0.1);
}
.txt {
	padding:0 40rpx;
	line-height: 80rpx;
	font-size: 30rpx;
	font-weight: bold;
	display: block;
	color: #dc797c;
}
.title{
	display: flex;
	justify-content: space-between;
	background-color: rgba(208,88,124,0.1);
	align-items: center;
}
.small {
	display: flex;
	align-items: center;
	font-size: 24rpx;
	color: #e58b7c;
	padding-right: 20rpx;
}
.txet-style{
	display: block;
	margin-bottom: 10rpx;
	font-family: "宋体";
	line-height: 40rpx;
}

.imgstyles{
	display: block;
	position: relative;
	top: 50%;
	left: 50%;
	transform: translateY(-50%)  translateX(-50%);
}
</style>